/*********************************************************************
*                                                                    *
*                SEGGER Microcontroller GmbH & Co. KG                *
*        Solutions for real time microcontroller applications        *
*                                                                    *
**********************************************************************
*                                                                    *
* C-file generated by:                                               *
*                                                                    *
*        GUI_Builder for emWin version 5.44                          *
*        Compiled Nov 10 2017, 08:53:57                              *
*        (c) 2017 Segger Microcontroller GmbH & Co. KG               *
*                                                                    *
**********************************************************************
*                                                                    *
*        Internet: www.segger.com  Support: support@segger.com       *
*                                                                    *
**********************************************************************
*/

// USER START (Optionally insert additional includes)
// USER END

#include "DIALOG.h"

extern GUI_CONST_STORAGE GUI_BITMAP bmfile_64px;
extern GUI_CONST_STORAGE GUI_BITMAP bmHelp_64px;
extern GUI_CONST_STORAGE GUI_BITMAP bmRun_64px;
extern GUI_CONST_STORAGE GUI_BITMAP bmsettings_64xp;
extern GUI_CONST_STORAGE GUI_BITMAP bmtext_editor_64px;

/*********************************************************************
*
*       Defines
*
**********************************************************************
*/
#define ID_WINDOW_0     (GUI_ID_USER + 0x00)
#define ID_BUTTON_0     (GUI_ID_USER + 0x03)
#define ID_BUTTON_1     (GUI_ID_USER + 0x04)
#define ID_BUTTON_2     (GUI_ID_USER + 0x05)
#define ID_BUTTON_3     (GUI_ID_USER + 0x06)
#define ID_BUTTON_4     (GUI_ID_USER + 0x07)
#define ID_BUTTON_5     (GUI_ID_USER + 0x08)

// USER START (Optionally insert additional defines)
// USER END

/*********************************************************************
*
*       Static data
*
**********************************************************************
*/

// USER START (Optionally insert additional static data)
// USER END

/*********************************************************************
*
*       _aDialogCreate
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] =
{
    { WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 1024, 600, 0, 0x0, 0 },
    { BUTTON_CreateIndirect, "Button", ID_BUTTON_0, 196, 231, 64, 64, 0, 0x0, 0 },
    { BUTTON_CreateIndirect, "Button", ID_BUTTON_1, 486, 230, 64, 64, 0, 0x0, 0 },
    { BUTTON_CreateIndirect, "Button", ID_BUTTON_2, 299, 231, 64, 64, 0, 0x0, 0 },
    { BUTTON_CreateIndirect, "Button", ID_BUTTON_3, 394, 231, 64, 64, 0, 0x0, 0 },
    { BUTTON_CreateIndirect, "Button", ID_BUTTON_4, 581, 231, 64, 64, 0, 0x0, 0 },
	{ BUTTON_CreateIndirect, "Button", ID_BUTTON_5, 768, 231, 64, 64, 0, 0x0, 0 },
    // USER START (Optionally insert additional widgets)
    // USER END
};

/*********************************************************************
*
*       Static code
*
**********************************************************************
*/

// USER START (Optionally insert additional static code)
// USER END

/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg)
{
    WM_HWIN hItem;
    int     NCode;
    int     Id;
    // USER START (Optionally insert additional variables)
    // USER END

    switch (pMsg->MsgId)
    {
        case WM_INIT_DIALOG:
            //
            // Initialization of 'Window'
            //
            hItem = pMsg->hWin;
            WINDOW_SetBkColor(hItem, GUI_MAKE_COLOR(0x0040FF00));
            // USER START (Optionally insert additional code for further widget initialization)
            // USER END
            break;

        case WM_NOTIFY_PARENT:
            Id    = WM_GetId(pMsg->hWinSrc);
            NCode = pMsg->Data.v;

            switch(Id)
            {
                case ID_BUTTON_0: // Notifications sent by 'Button'
                    switch(NCode)
                    {
                        case WM_NOTIFICATION_CLICKED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;

                        case WM_NOTIFICATION_RELEASED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                            // USER START (Optionally insert additional code for further notification handling)
                            // USER END
                    }

                    break;

                case ID_BUTTON_1: // Notifications sent by 'Button'
                    switch(NCode)
                    {
                        case WM_NOTIFICATION_CLICKED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;

                        case WM_NOTIFICATION_RELEASED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                            // USER START (Optionally insert additional code for further notification handling)
                            // USER END
                    }

                    break;

                case ID_BUTTON_2: // Notifications sent by 'Button'
                    switch(NCode)
                    {
                        case WM_NOTIFICATION_CLICKED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;

                        case WM_NOTIFICATION_RELEASED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                            // USER START (Optionally insert additional code for further notification handling)
                            // USER END
                    }

                    break;

                case ID_BUTTON_3: // Notifications sent by 'Button'
                    switch(NCode)
                    {
                        case WM_NOTIFICATION_CLICKED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;

                        case WM_NOTIFICATION_RELEASED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                            // USER START (Optionally insert additional code for further notification handling)
                            // USER END
                    }

                    break;

                case ID_BUTTON_4: // Notifications sent by 'Button'
                    switch(NCode)
                    {
                        case WM_NOTIFICATION_CLICKED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;

                        case WM_NOTIFICATION_RELEASED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                            // USER START (Optionally insert additional code for further notification handling)
                            // USER END
                    }

                    break;
                    // USER START (Optionally insert additional code for further Ids)
                    // USER END

				case ID_BUTTON_5: // Notifications sent by 'Button'
                    switch(NCode)
                    {
                        case WM_NOTIFICATION_CLICKED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;

                        case WM_NOTIFICATION_RELEASED:
                            // USER START (Optionally insert code for reacting on notification message)
                            // USER END
                            break;
                            // USER START (Optionally insert additional code for further notification handling)
                            // USER END
                    }

                    break;
                    // USER START (Optionally insert additional code for further Ids)
                    // USER END
            }

            break;

        // USER START (Optionally insert additional message handling)
        // USER END
        default:
            WM_DefaultProc(pMsg);
            break;
    }
}


/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       CreateWindow
*/

void MainTask(void)
{
    WM_HWIN hWin;

    hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);

    while(1)
    {
        GUI_Delay(50);
    }
}

// USER START (Optionally insert additional public code)
// USER END

/*************************** End of file ****************************/
